/**
 * $Revision: 1.0 $
 * $Author: Eric Yang $
 * $Date: Aug 9, 2009 10:55:58 PM $
 *
 * Author: Eric Yang
 * Date  : Aug 9, 2009 10:55:58 PM
 *
 */
package com.gooex.web.action.organization.global;

import com.gooex.domain.organization.User;
import com.gooex.web.action.BaseAnonymousAction;


/**
 * @author Eric Yang
 * @version 1.0
 */
public class LoginAction extends BaseAnonymousAction {

	private String account;

	private String password;

	public String execute() throws Exception {
		User user = userManager.getUserByAccount(account);
		if (user != null) {
			if (user.authorize(password)) {
				sessionContext.setSessionFlag(user);
				return SUCCESS;
			}
		}
		addActionError("Error user name or password!");
		return INPUT;
	}

	public void setAccount(String name) {
		this.account = name;
	}

	public void setPassword(String password) {
		this.password = password;
	}

}
